From: Ian Campbell Date: Wed, 17 Feb 2016 14:58:33 +0000 (+0000) Subject: xenpaging: do not leak if --pagefile given twice X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~1737 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/%22bookmarks://%22Dat/%22http:/www.example.com/cgi/%22https:/%22bookmarks:/%22Dat?a=commitdiff_plain;h=7e1e001fa7d9d9df300ced3fb83df5f12ebb722b;p=xen.git xenpaging: do not leak if --pagefile given twice By freeing filename (which is either NULL or the previous iteration of this argument). This implements a semantic where the last --pagefile given on the command line takes precedence. This is the same semantic as the other options have. CID: 1198792 Reviewed-by: Konrad Rzeszutek Wilk Signed-off-by: Ian Campbell --- diff --git a/tools/xenpaging/xenpaging.c b/tools/xenpaging/xenpaging.c index 0377507e11..6157d3a4b6 100644 --- a/tools/xenpaging/xenpaging.c +++ b/tools/xenpaging/xenpaging.c @@ -232,6 +232,7 @@ static int xenpaging_getopts(struct xenpaging *paging, int argc, char *argv[]) paging->vm_event.domain_id = atoi(optarg); break; case 'f': + free(filename); filename = strdup(optarg); break; case 'm':